/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Dietplan_panel.java
 *
 * Created on 23-05-2009, 12:59:59
 */
package VIEW;

import CONTROLLER.Controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
import javax.swing.DefaultListModel;

/**
 *
 * @author Irene
 */
public class Dietplan_panel extends javax.swing.JPanel implements Observer {

    private Controller ctrl;

    /** Creates new form Dietplan_panel
     * @param ctrl 
     */
    public Dietplan_panel(Controller ctrl) {
        this.ctrl = ctrl;
        initComponents();
        ctrl.addObserver(this);

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Dietplan_panel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        mondayMealList = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        tuesdayListMeal = new javax.swing.JList();
        jScrollPane3 = new javax.swing.JScrollPane();
        wednesdayListMeal = new javax.swing.JList();
        jScrollPane4 = new javax.swing.JScrollPane();
        ThursdayListMeal = new javax.swing.JList();
        jScrollPane5 = new javax.swing.JScrollPane();
        fridayListMeal = new javax.swing.JList();
        jScrollPane6 = new javax.swing.JScrollPane();
        saturdayListMeal = new javax.swing.JList();
        jScrollPane7 = new javax.swing.JScrollPane();
        sundayListMeal = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        addMealMonday = new javax.swing.JButton();
        addWednesdayMeal = new javax.swing.JButton();
        addSundayMeal = new javax.swing.JButton();
        addSaturdayMeal = new javax.swing.JButton();
        addFridayMeal = new javax.swing.JButton();
        addThursdayMeal = new javax.swing.JButton();
        addTuesdayMeal = new javax.swing.JButton();
        deleteMondayMeal = new javax.swing.JButton();
        deleteSaturdayList = new javax.swing.JButton();
        deleteSundayMeal = new javax.swing.JButton();
        deleteFrirdaymeal = new javax.swing.JButton();
        deleteThursdayMeal = new javax.swing.JButton();
        deleteTuesdayMeal = new javax.swing.JButton();
        deleteWednesdayMeal = new javax.swing.JButton();
        jScrollPane8 = new javax.swing.JScrollPane();
        standardMealList = new javax.swing.JList();
        jLabel9 = new javax.swing.JLabel();
        addMealList = new javax.swing.JButton();
        deletemealStandard = new javax.swing.JButton();
        bfField = new javax.swing.JTextField();
        lunchField = new javax.swing.JTextField();
        dinnerField = new javax.swing.JTextField();
        snackField = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        snack2Field = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        cleatButton = new javax.swing.JButton();

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("Dietplan");

        mondayMealList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane1.setViewportView(mondayMealList);

        tuesdayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane2.setViewportView(tuesdayListMeal);

        wednesdayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane3.setViewportView(wednesdayListMeal);

        ThursdayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane4.setViewportView(ThursdayListMeal);

        fridayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane5.setViewportView(fridayListMeal);

        saturdayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane6.setViewportView(saturdayListMeal);

        sundayListMeal.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane7.setViewportView(sundayListMeal);

        jLabel2.setText("Monday");

        jLabel3.setText("Tuesday");

        jLabel4.setText("Wednesday");

        jLabel5.setText("Saturday");

        jLabel6.setText("Friday");

        jLabel7.setText("Thursday");

        jLabel8.setText("Sunday");

        addMealMonday.setText("Add To");
        addMealMonday.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addMealMondayActionPerformed(evt);
            }
        });

        addWednesdayMeal.setText("Add To");
        addWednesdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addWednesdayMealActionPerformed(evt);
            }
        });

        addSundayMeal.setText("Add To");
        addSundayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addSundayMealActionPerformed(evt);
            }
        });

        addSaturdayMeal.setText("Add To");
        addSaturdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addSaturdayMealActionPerformed(evt);
            }
        });

        addFridayMeal.setText("Add To");
        addFridayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addFridayMealActionPerformed(evt);
            }
        });

        addThursdayMeal.setText("Add To");
        addThursdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addThursdayMealActionPerformed(evt);
            }
        });

        addTuesdayMeal.setText("Add To");
        addTuesdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addTuesdayMealActionPerformed(evt);
            }
        });

        deleteMondayMeal.setText("Delete Meal");
        deleteMondayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteMondayMealActionPerformed(evt);
            }
        });

        deleteSaturdayList.setText("Delete Meal");
        deleteSaturdayList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteSaturdayListActionPerformed(evt);
            }
        });

        deleteSundayMeal.setText("Delete Item");
        deleteSundayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteSundayMealActionPerformed(evt);
            }
        });

        deleteFrirdaymeal.setText("Delete Meal");
        deleteFrirdaymeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteFrirdaymealActionPerformed(evt);
            }
        });

        deleteThursdayMeal.setText("Delete Meal");
        deleteThursdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteThursdayMealActionPerformed(evt);
            }
        });

        deleteTuesdayMeal.setText("Delete Meal");
        deleteTuesdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteTuesdayMealActionPerformed(evt);
            }
        });

        deleteWednesdayMeal.setText("Delete Meal");
        deleteWednesdayMeal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteWednesdayMealActionPerformed(evt);
            }
        });

        standardMealList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jScrollPane8.setViewportView(standardMealList);

        jLabel9.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel9.setText("Select Standard Item and add to weekday");

        addMealList.setText("Add To Standardlist");
        addMealList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addMealListActionPerformed(evt);
            }
        });

        deletemealStandard.setText("Delete Item");
        deletemealStandard.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deletemealStandardActionPerformed(evt);
            }
        });

        bfField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bfFieldActionPerformed(evt);
            }
        });

        jLabel10.setText("Breakfast:");

        jLabel11.setText("Lunch:");

        jLabel13.setText("Dinner:");

        jLabel14.setText("Snack1:");

        jLabel15.setText("Overview over this weeks meals");

        jLabel16.setText("Snack2:");

        cleatButton.setText("Clear");
        cleatButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cleatButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout Dietplan_panelLayout = new javax.swing.GroupLayout(Dietplan_panel);
        Dietplan_panel.setLayout(Dietplan_panelLayout);
        Dietplan_panelLayout.setHorizontalGroup(
            Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel1)))
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Dietplan_panelLayout.createSequentialGroup()
                                .addComponent(addMealMonday)
                                .addGap(84, 84, 84))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel2)
                                .addGap(103, 103, 103)))
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel3))
                            .addComponent(addTuesdayMeal))
                        .addGap(89, 89, 89)
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(addWednesdayMeal, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(91, 91, 91))
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(20, 20, 20)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jScrollPane1)
                                    .addComponent(deleteMondayMeal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(53, 53, 53)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jScrollPane2)
                                    .addComponent(deleteTuesdayMeal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addGap(52, 52, 52))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(19, 19, 19)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel11)
                                    .addComponent(jLabel10)
                                    .addComponent(jLabel13)
                                    .addComponent(jLabel14)
                                    .addComponent(jLabel16))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(snack2Field, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                                    .addComponent(snackField, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                                    .addComponent(dinnerField, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                                    .addComponent(bfField, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                                    .addComponent(lunchField, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE))
                                .addGap(25, 25, 25)))
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cleatButton)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(deleteWednesdayMeal))))
                        .addGap(92, 92, 92)))
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(17, 17, 17)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(addThursdayMeal)
                                    .addComponent(jLabel7)))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(deleteThursdayMeal))))
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(52, 52, 52)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(deleteFrirdaymeal)))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(78, 78, 78)
                                .addComponent(jLabel6))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(addMealList)
                                    .addComponent(addFridayMeal))))
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(deleteSaturdayList)
                                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                        .addGap(10, 10, 10)
                                        .addComponent(jLabel5))
                                    .addComponent(addSaturdayMeal))
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
                                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                                .addGap(31, 31, 31)
                                                .addComponent(jLabel8))
                                            .addComponent(deleteSundayMeal))
                                        .addGap(128, 128, 128))
                                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                        .addGap(57, 57, 57)
                                        .addComponent(addSundayMeal))))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(deletemealStandard)
                                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(159, 159, 159))
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGap(157, 157, 157)
                        .addComponent(jLabel9)
                        .addContainerGap())))
        );
        Dietplan_panelLayout.setVerticalGroup(
            Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, Dietplan_panelLayout.createSequentialGroup()
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(6, 6, 6)
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel15)
                            .addComponent(jLabel9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel10)
                                    .addComponent(bfField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel11)
                                    .addComponent(lunchField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel13)
                                    .addComponent(dinnerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel14)
                                    .addComponent(snackField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cleatButton))
                                .addGap(18, 18, 18)
                                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel16)
                                    .addComponent(snack2Field, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(Dietplan_panelLayout.createSequentialGroup()
                                .addGap(25, 25, 25)
                                .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(deletemealStandard))))
                    .addGroup(Dietplan_panelLayout.createSequentialGroup()
                        .addGap(88, 88, 88)
                        .addComponent(addMealList)))
                .addGap(36, 36, 36)
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(addWednesdayMeal)
                    .addComponent(addMealMonday)
                    .addComponent(addTuesdayMeal)
                    .addComponent(addThursdayMeal)
                    .addComponent(addFridayMeal)
                    .addComponent(addSaturdayMeal)
                    .addComponent(addSundayMeal))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(jLabel5)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Dietplan_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(deleteTuesdayMeal)
                    .addComponent(deleteMondayMeal)
                    .addComponent(deleteWednesdayMeal)
                    .addComponent(deleteThursdayMeal)
                    .addComponent(deleteFrirdaymeal)
                    .addComponent(deleteSaturdayList)
                    .addComponent(deleteSundayMeal))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(Dietplan_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(Dietplan_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(35, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void bfFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bfFieldActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_bfFieldActionPerformed

    private void deletemealStandardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deletemealStandardActionPerformed
        String meal = (String) standardMealList.getSelectedValue();
     ctrl.removeStandardMeal(meal);
}//GEN-LAST:event_deletemealStandardActionPerformed

    private void addMealMondayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMealMondayActionPerformed

        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addMondayFood(meals);

    }//GEN-LAST:event_addMealMondayActionPerformed

    private void addTuesdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTuesdayMealActionPerformed
        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addTuesdayFood(meals);



    }//GEN-LAST:event_addTuesdayMealActionPerformed

    private void addWednesdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addWednesdayMealActionPerformed

        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addWednesdayFood(meals);


    }//GEN-LAST:event_addWednesdayMealActionPerformed

    private void addThursdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addThursdayMealActionPerformed
        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addThursdayFood(meals);



    }//GEN-LAST:event_addThursdayMealActionPerformed

    private void addFridayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addFridayMealActionPerformed
        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addFridayFood(meals);




    }//GEN-LAST:event_addFridayMealActionPerformed

    private void addSaturdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSaturdayMealActionPerformed

        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addSaturdayFood(meals);


    }//GEN-LAST:event_addSaturdayMealActionPerformed

    private void addSundayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addSundayMealActionPerformed
        List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());

        String s = (String) standardMealList.getSelectedValue();
        if (s != null) {
            meals.add(s);
        }

        ctrl.addSundayFood(meals);

    }//GEN-LAST:event_addSundayMealActionPerformed

    private void deleteMondayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMondayMealActionPerformed
        String s = (String) mondayMealList.getSelectedValue();
        ctrl.removeMondayMeal(s);
    }//GEN-LAST:event_deleteMondayMealActionPerformed

    private void deleteTuesdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteTuesdayMealActionPerformed
        String s = (String) tuesdayListMeal.getSelectedValue();
        ctrl.removeTuesdayMeal(s);


    }//GEN-LAST:event_deleteTuesdayMealActionPerformed

    private void deleteWednesdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteWednesdayMealActionPerformed
        String s = (String) wednesdayListMeal.getSelectedValue();
        ctrl.removeWednesdayMeal(s);

    }//GEN-LAST:event_deleteWednesdayMealActionPerformed

    private void deleteThursdayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteThursdayMealActionPerformed
        String s = (String) ThursdayListMeal.getSelectedValue();
        ctrl.removeThursdayMeal(s);
    }//GEN-LAST:event_deleteThursdayMealActionPerformed

    private void deleteFrirdaymealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteFrirdaymealActionPerformed
        String s = (String) fridayListMeal.getSelectedValue();
        ctrl.removeFridayMeal(s);
    }//GEN-LAST:event_deleteFrirdaymealActionPerformed

    private void deleteSaturdayListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSaturdayListActionPerformed
        String s = (String) saturdayListMeal.getSelectedValue();
        ctrl.removeSaturdayMeal(s);
    }//GEN-LAST:event_deleteSaturdayListActionPerformed

    private void deleteSundayMealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteSundayMealActionPerformed
        String s = (String) sundayListMeal.getSelectedValue();
        ctrl.removeSundayMeal(s);
    }//GEN-LAST:event_deleteSundayMealActionPerformed

    private void cleatButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cleatButtonActionPerformed
        bfField.setText("");
        lunchField.setText("");
        dinnerField.setText("");
        snackField.setText("");
        snack2Field.setText("");
    }//GEN-LAST:event_cleatButtonActionPerformed

    private void addMealListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addMealListActionPerformed

         List<String> meals = new ArrayList<String>();
        meals.add(bfField.getText());
        meals.add(lunchField.getText());
        meals.add(dinnerField.getText());
        meals.add(snackField.getText());
        meals.add(snack2Field.getText());


        ctrl.addToStandard(meals);


    }//GEN-LAST:event_addMealListActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Dietplan_panel;
    private javax.swing.JList ThursdayListMeal;
    private javax.swing.JButton addFridayMeal;
    private javax.swing.JButton addMealList;
    private javax.swing.JButton addMealMonday;
    private javax.swing.JButton addSaturdayMeal;
    private javax.swing.JButton addSundayMeal;
    private javax.swing.JButton addThursdayMeal;
    private javax.swing.JButton addTuesdayMeal;
    private javax.swing.JButton addWednesdayMeal;
    private javax.swing.JTextField bfField;
    private javax.swing.JButton cleatButton;
    private javax.swing.JButton deleteFrirdaymeal;
    private javax.swing.JButton deleteMondayMeal;
    private javax.swing.JButton deleteSaturdayList;
    private javax.swing.JButton deleteSundayMeal;
    private javax.swing.JButton deleteThursdayMeal;
    private javax.swing.JButton deleteTuesdayMeal;
    private javax.swing.JButton deleteWednesdayMeal;
    private javax.swing.JButton deletemealStandard;
    private javax.swing.JTextField dinnerField;
    private javax.swing.JList fridayListMeal;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JTextField lunchField;
    private javax.swing.JList mondayMealList;
    private javax.swing.JList saturdayListMeal;
    private javax.swing.JTextField snack2Field;
    private javax.swing.JTextField snackField;
    private javax.swing.JList standardMealList;
    private javax.swing.JList sundayListMeal;
    private javax.swing.JList tuesdayListMeal;
    private javax.swing.JList wednesdayListMeal;
    // End of variables declaration//GEN-END:variables

    public void update(Observable o, Object arg) {
        updateDietplan();
        System.out.println("dietplan virker");
    }

    public void updateDietplan() {
        DefaultListModel list = ctrl.getMondayFoodList();
        mondayMealList.setModel(list);
        DefaultListModel nlist = ctrl.getTuesdayFoodList();
        tuesdayListMeal.setModel(nlist);
        DefaultListModel wlist = ctrl.getWednesdayFoodList();
        wednesdayListMeal.setModel(wlist);
        DefaultListModel thlist = ctrl.getThursdayFoodList();
        ThursdayListMeal.setModel(thlist);
        DefaultListModel flist = ctrl.getFridayFoodList();
        fridayListMeal.setModel(flist);
        DefaultListModel slist = ctrl.getSaturdayFoodList();
        saturdayListMeal.setModel(slist);
        DefaultListModel sulist = ctrl.getSundayFoodList();
        sundayListMeal.setModel(sulist);
        DefaultListModel stanList = ctrl.getStandardFoodList();
        standardMealList.setModel(stanList);
         repaint();

    }
}

